3.227 \(\int \frac{\cot (e+f x)}{(a+b \tan ^2(e+f x))^2} \, dx\)

Optimal. Leaf size=103 \[ \frac{b (2 a-b) \log \left (a+b \tan ^2(e+f x)\right )}{2 a^2 f (a-b)^2}+\frac{\log (\tan (e+f x))}{a^2 f}-\frac{b}{2 a f (a-b) \left (a+b \tan ^2(e+f x)\right )}+\frac{\log (\cos (e+f x))}{f (a-b)^2} \]

[Out]

Log[Cos[e + f*x]]/((a - b)^2*f) + Log[Tan[e + f*x]]/(a^2*f) + ((2*a - b)*b*Log[a + b*Tan[e + f*x]^2])/(2*a^2*(
a - b)^2*f) - b/(2*a*(a - b)*f*(a + b*Tan[e + f*x]^2))

________________________________________________________________________________________

Rubi [A]  time = 0.120596, antiderivative size = 103, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3670, 446, 72} \[ \frac{b (2 a-b) \log \left (a+b \tan ^2(e+f x)\right )}{2 a^2 f (a-b)^2}+\frac{\log (\tan (e+f x))}{a^2 f}-\frac{b}{2 a f (a-b) \left (a+b \tan ^2(e+f x)\right )}+\frac{\log (\cos (e+f x))}{f (a-b)^2} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

Log[Cos[e + f*x]]/((a - b)^2*f) + Log[Tan[e + f*x]]/(a^2*f) + ((2*a - b)*b*Log[a + b*Tan[e + f*x]^2])/(2*a^2*(
a - b)^2*f) - b/(2*a*(a - b)*f*(a + b*Tan[e + f*x]^2))

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 446

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 72

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rubi steps

\begin{align*} \int \frac{\cot (e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{1}{x \left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \frac{1}{x (1+x) (a+b x)^2} \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{\operatorname{Subst}\left (\int \left (\frac{1}{a^2 x}-\frac{1}{(a-b)^2 (1+x)}+\frac{b^2}{a (a-b) (a+b x)^2}+\frac{(2 a-b) b^2}{a^2 (a-b)^2 (a+b x)}\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{\log (\cos (e+f x))}{(a-b)^2 f}+\frac{\log (\tan (e+f x))}{a^2 f}+\frac{(2 a-b) b \log \left (a+b \tan ^2(e+f x)\right )}{2 a^2 (a-b)^2 f}-\frac{b}{2 a (a-b) f \left (a+b \tan ^2(e+f x)\right )}\\ \end{align*}

Mathematica [A]  time = 1.98596, size = 90, normalized size = 0.87 \[ \frac{\frac{\frac{b \left (\frac{a (b-a)}{a+b \tan ^2(e+f x)}+(2 a-b) \log \left (a+b \tan ^2(e+f x)\right )\right )}{(a-b)^2}+2 \log (\tan (e+f x))}{a^2}+\frac{2 \log (\cos (e+f x))}{(a-b)^2}}{2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

((2*Log[Cos[e + f*x]])/(a - b)^2 + (2*Log[Tan[e + f*x]] + (b*((2*a - b)*Log[a + b*Tan[e + f*x]^2] + (a*(-a + b
))/(a + b*Tan[e + f*x]^2)))/(a - b)^2)/a^2)/(2*f)

________________________________________________________________________________________

Maple [A]  time = 0.092, size = 160, normalized size = 1.6 \begin{align*}{\frac{\ln \left ( \cos \left ( fx+e \right ) +1 \right ) }{2\,f{a}^{2}}}+{\frac{{b}^{2}}{2\,fa \left ( a-b \right ) ^{2} \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }}+{\frac{b\ln \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }{fa \left ( a-b \right ) ^{2}}}-{\frac{{b}^{2}\ln \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }{2\,f{a}^{2} \left ( a-b \right ) ^{2}}}+{\frac{\ln \left ( \cos \left ( fx+e \right ) -1 \right ) }{2\,f{a}^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)/(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/2/f/a^2*ln(cos(f*x+e)+1)+1/2/f*b^2/a/(a-b)^2/(a*cos(f*x+e)^2-cos(f*x+e)^2*b+b)+1/f*b/a/(a-b)^2*ln(a*cos(f*x+
e)^2-cos(f*x+e)^2*b+b)-1/2/f*b^2/a^2/(a-b)^2*ln(a*cos(f*x+e)^2-cos(f*x+e)^2*b+b)+1/2/f/a^2*ln(cos(f*x+e)-1)

________________________________________________________________________________________

Maxima [A]  time = 1.12036, size = 167, normalized size = 1.62 \begin{align*} \frac{\frac{b^{2}}{a^{4} - 2 \, a^{3} b + a^{2} b^{2} -{\left (a^{4} - 3 \, a^{3} b + 3 \, a^{2} b^{2} - a b^{3}\right )} \sin \left (f x + e\right )^{2}} + \frac{{\left (2 \, a b - b^{2}\right )} \log \left (-{\left (a - b\right )} \sin \left (f x + e\right )^{2} + a\right )}{a^{4} - 2 \, a^{3} b + a^{2} b^{2}} + \frac{\log \left (\sin \left (f x + e\right )^{2}\right )}{a^{2}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/2*(b^2/(a^4 - 2*a^3*b + a^2*b^2 - (a^4 - 3*a^3*b + 3*a^2*b^2 - a*b^3)*sin(f*x + e)^2) + (2*a*b - b^2)*log(-(
a - b)*sin(f*x + e)^2 + a)/(a^4 - 2*a^3*b + a^2*b^2) + log(sin(f*x + e)^2)/a^2)/f

________________________________________________________________________________________

Fricas [A]  time = 1.27703, size = 439, normalized size = 4.26 \begin{align*} \frac{a b^{2} \tan \left (f x + e\right )^{2} + a b^{2} +{\left (a^{3} - 2 \, a^{2} b + a b^{2} +{\left (a^{2} b - 2 \, a b^{2} + b^{3}\right )} \tan \left (f x + e\right )^{2}\right )} \log \left (\frac{\tan \left (f x + e\right )^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) +{\left (2 \, a^{2} b - a b^{2} +{\left (2 \, a b^{2} - b^{3}\right )} \tan \left (f x + e\right )^{2}\right )} \log \left (\frac{b \tan \left (f x + e\right )^{2} + a}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \,{\left ({\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f \tan \left (f x + e\right )^{2} +{\left (a^{5} - 2 \, a^{4} b + a^{3} b^{2}\right )} f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/2*(a*b^2*tan(f*x + e)^2 + a*b^2 + (a^3 - 2*a^2*b + a*b^2 + (a^2*b - 2*a*b^2 + b^3)*tan(f*x + e)^2)*log(tan(f
*x + e)^2/(tan(f*x + e)^2 + 1)) + (2*a^2*b - a*b^2 + (2*a*b^2 - b^3)*tan(f*x + e)^2)*log((b*tan(f*x + e)^2 + a
)/(tan(f*x + e)^2 + 1)))/((a^4*b - 2*a^3*b^2 + a^2*b^3)*f*tan(f*x + e)^2 + (a^5 - 2*a^4*b + a^3*b^2)*f)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)**2)**2,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.36656, size = 205, normalized size = 1.99 \begin{align*} \frac{\frac{{\left (2 \, a b - b^{2}\right )} \log \left ({\left | -a \sin \left (f x + e\right )^{2} + b \sin \left (f x + e\right )^{2} + a \right |}\right )}{a^{4} - 2 \, a^{3} b + a^{2} b^{2}} - \frac{2 \, a b \sin \left (f x + e\right )^{2} - b^{2} \sin \left (f x + e\right )^{2} - 2 \, a b}{{\left (a^{3} - a^{2} b\right )}{\left (a \sin \left (f x + e\right )^{2} - b \sin \left (f x + e\right )^{2} - a\right )}} + \frac{\log \left (\sin \left (f x + e\right )^{2}\right )}{a^{2}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/2*((2*a*b - b^2)*log(abs(-a*sin(f*x + e)^2 + b*sin(f*x + e)^2 + a))/(a^4 - 2*a^3*b + a^2*b^2) - (2*a*b*sin(f
*x + e)^2 - b^2*sin(f*x + e)^2 - 2*a*b)/((a^3 - a^2*b)*(a*sin(f*x + e)^2 - b*sin(f*x + e)^2 - a)) + log(sin(f*
x + e)^2)/a^2)/f